package com.crm.service.impl.csd.reviewManager;

import com.crm.dao.mapper.csd.reviewManager.PutOnRecordInformationMapper;
import com.crm.dao.mapper.customMapper.csd.PutOnRecordInformationCustomMapper;
import com.crm.model.entity.csd.reviewManager.PutOnRecordInformation;
import com.crm.model.entity.csd.reviewManager.PutOnRecordInformationExample;
import com.crm.model.qo.csd.reviewManager.PutOnRecordInformationQO;
import com.crm.model.vo.csd.reviewManager.PutOnRecordInformationVO;
import com.crm.service.csd.reviewManager.PutOnRecordInformationDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yincuimei
 * @Date 2021/8/10 8:56
 * (客服部)-审核管理-》备案信息
 */
@Service
public class PutOnRecordInformationDbServiceIml implements PutOnRecordInformationDbService {

    @Autowired
    private PutOnRecordInformationCustomMapper putOnRecordInformationCustomMapper;

    @Autowired
    private PutOnRecordInformationMapper putOnRecordInformationMapper;

    /**
     * 备案信息列表
     * @param putOnRecordInformationQO --查询条件
     * @param orderStr                 --排序
     * @return
     * @author yincuimei
     */
    @Override
    public List<PutOnRecordInformationVO> selectPutOnRecordInformationVOList(PutOnRecordInformationQO putOnRecordInformationQO, String orderStr) {
        return putOnRecordInformationCustomMapper.selectPutOnRecordInformationVOList(putOnRecordInformationQO,orderStr);
    }

    /**
     * 新增备案信息
     * @param putOnRecordInformation  --新增备案信息实体类
     * @author yincuimei
     * @return
     */
    @Override
    public Boolean insertPutOnRecordInformation(PutOnRecordInformation putOnRecordInformation) {
        return putOnRecordInformationMapper.insert(putOnRecordInformation) > 0;
    }

    /**
     * 新增时查询备案信息是否重复(企业名、企业信用代码)
     * @param putOnRecordInformationExample
     * @author yincuimei
     * @return
     */
    @Override
    public Boolean selectPutOnRecordInformationIsRepeat(PutOnRecordInformationExample putOnRecordInformationExample) {
        return putOnRecordInformationMapper.selectByExample(putOnRecordInformationExample).size() > 0;
    }
}
